import numpy as np

def AND(x1,x2):
    w1,w2,q=0.5,0.5,0.7
    res=w1*x1+w2*x2
    if res > q:
        return True
    else:
        return False
    
def AND_USE_NP(x1,x2):
    x = np.array([x1,x2])
    w = np.array([0.5,0.5])
    b = 0.7
    res = np.sum(x*w) - b
    # import pdb 
    # pdb.set_trace()
    if res > 0:
        return 1
    else: 
        return 0